def greet_user():
    """显示简单的问候语"""
    print("Hello!")
greet_user()
def describe_pet( pet_name,animal_type = 'dog'):
    print(f"\nI have a {animal_type}.")
    print(f"My {animal_type}'s name is {pet_name}")
describe_pet("white")
describe_pet("flower", animal_type='cat')

def bulid_person(first_name, last_name):
    person = {'first':first_name, 'last':last_name}
    return person
musician = bulid_person('jimi', 'hendrix')
print(musician)

def get_formatted_name(first_name, last_name):
    full_name = f"{first_name} {last_name}"
    return full_name.title()
while True:
    print("\nPlease tell me your name:")
    f_name = input("First name:")
    if f_name == 'q':
        break
    l_name = input("Last name:")
    if l_name == 'q':
        break
    formatted_name = get_formatted_name(f_name, l_name)
    print('\nHello, {formatted_name}')

unprinted_designs = ['phone case', 'robot pendant', 'dodecahedron']
completed_models = []
while unprinted_designs:
    current_design = unprinted_designs.pop()
    print(f"Printing model:{current_design}")
    completed_models.append(current_design)
print("\nThe following models have been printed:")
for completed_model in completed_models:
    print(completed_model)
def print_models(unprinted_designs, completed_models):
    while unprinted_designs:
        current_design = unprinted_designs.pop()
        print(f"Printing model:{current_design}")
        completed_models.append(current_design)        
def show_completed_models(completed_models):
    print("\nThe following models have been printed:")
    for completed_model in completed_models:
        print(completed_model)
print_models(unprinted_designs, completed_model)
show_completed_models(completed_models)

#列表形参
def make_pizza(*toppings):
    print(toppings)
make_pizza('pepperoni')
make_pizza('mushroom', 'green peppers', 'extra cheese')

#字典形参
def bulid_profile(first, last, **user_info):
    user_info['first_name'] = first
    user_info['last_name'] = last
    return user_info
user_profile = bulid_profile('albert', 'einstein',
                             location = 'princeton',
                             field = 'physics')
print(user_profile)


